-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a parameter cacheValuesOnly
to Cache.make.*
#160
Conversation
This is another way to do it. The irregularity with both of these approaches to some extent is that it isn't true that we are caching values only. If computing the value takes five seconds everyone who gets the value within those five seconds is going to receive the same "cached" value computed whether it is a success or failure. |
Thank you for your reply.
Can you explain it in more detail? I don't know what your point is. In this PR, if we call
|
Consider that fiber A calls And similarly a fiber that calls Basically the nature of the asynchronous cache forces us to decide at the time we begin computing the value whether we will cache it or not, at least for other fibers that attempt to compute the value at the same time, but we don't know if the result is the failure until the time we finish computing the value. |
I see your point. Since we don't know the result is the failure or not until the time we compute the value, this approach is also unlikely to be a solution... 😢 (Or is there an another option to solve the above problem?)
|
Closing as stale, feel free to reopen if needed! |
This PR is a different approach for #159
Differences between previous #159
refreshValue
like the previous PR.cacheValuesOnly
is true, cache can store values only. It means ifget
returns an error, then the promise (made inrefresh
) failed or lookup returned an error when the cache is empty. Therefore, we can delete the inconsistency from previous PR.